<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>


    let Shop = (function () {

        let s = {
            /**
             * 牛排
             */
            Steak(){
                this.price = 30
                this.time = 20
            },

            /**
             * 烧烤
             */
            Grill(){
                this.price = 20
                this.time = 15
            },

            /**
             * 面条
             */
            Noodles(){
                this.price = 15
                this.time = 10
            },

            /**
             * 炒饭
             */
            Rice(){
                this.price = 8
                this.time = 5
            }
        }

        return class Shop{
            constructor(w){
                this._name = w
                /*if(this[w]){

                }*/
                try{
                    s[w].call(this)
                }catch (e) {
                    throw new Error("你需要的餐点不提供！")
                }
            }

            done(){
                console.log(this._name + "制作完成，价格：" + this.price + "耗时：" + this.time);
            }
        }

    })();
    



    let a = new Shop("Steak")
    a.done()
    let b = new Shop("Noodles")
    b.done()
    let c = new Shop("Malatang")


</script>
</body>
</html>